home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / pangomm-1.4 / pangomm / fontdescription.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-04-20  |  16.0 KB  |  531 lines

  1. // -*- c++ -*-
  2. // Generated by gtkmmproc -- DO NOT MODIFY!
  3. #ifndef _PANGOMM_FONTDESCRIPTION_H
  4. #define _PANGOMM_FONTDESCRIPTION_H
  5.  
  6. #include <glibmm.h>
  7.  
  8. /* $Id: fontdescription.hg,v 1.1.1.1 2003/01/21 13:41:03 murrayc Exp $ */
  9.  
  10. /* fontdescription.h
  11.  *
  12.  * Copyright (C) 1998-2002 The gtkmm Development Team
  13.  *
  14.  * This library is free software; you can redistribute it and/or
  15.  * modify it under the terms of the GNU Library General Public
  16.  * License as published by the Free Software Foundation; either
  17.  * version 2 of the License, or (at your option) any later version.
  18.  *
  19.  * This library is distributed in the hope that it will be useful,
  20.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  22.  * Library General Public License for more details.
  23.  *
  24.  * You should have received a copy of the GNU Library General Public
  25.  * License along with this library; if not, write to the Free
  26.  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  27.  */
  28.  
  29. #include <pango/pango-font.h>
  30.  
  31.  
  32. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  33. extern "C" { typedef struct _PangoFontDescription PangoFontDescription; }
  34. #endif
  35.  
  36. namespace Pango
  37. {
  38.  
  39.  
  40. /** @addtogroup pangommEnums Enums and Flags */
  41.  
  42. /**
  43.  * @ingroup pangommEnums
  44.  */
  45. enum Style
  46. {
  47.   STYLE_NORMAL,
  48.   STYLE_OBLIQUE,
  49.   STYLE_ITALIC
  50. };
  51.  
  52. } // namespace Pango
  53.  
  54.  
  55. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  56. namespace Glib
  57. {
  58.  
  59. template <>
  60. class Value<Pango::Style> : public Glib::Value_Enum<Pango::Style>
  61. {
  62. public:
  63.   static GType value_type() G_GNUC_CONST;
  64. };
  65.  
  66. } // namespace Glib
  67. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  68.  
  69.  
  70. namespace Pango
  71. {
  72.  
  73. /**
  74.  * @ingroup pangommEnums
  75.  */
  76. enum Variant
  77. {
  78.   VARIANT_NORMAL,
  79.   VARIANT_SMALL_CAPS
  80. };
  81.  
  82. } // namespace Pango
  83.  
  84.  
  85. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  86. namespace Glib
  87. {
  88.  
  89. template <>
  90. class Value<Pango::Variant> : public Glib::Value_Enum<Pango::Variant>
  91. {
  92. public:
  93.   static GType value_type() G_GNUC_CONST;
  94. };
  95.  
  96. } // namespace Glib
  97. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  98.  
  99.  
  100. namespace Pango
  101. {
  102.  
  103. /**
  104.  * @ingroup pangommEnums
  105.  */
  106. enum Stretch
  107. {
  108.   STRETCH_ULTRA_CONDENSED,
  109.   STRETCH_EXTRA_CONDENSED,
  110.   STRETCH_CONDENSED,
  111.   STRETCH_SEMI_CONDENSED,
  112.   STRETCH_NORMAL,
  113.   STRETCH_SEMI_EXPANDED,
  114.   STRETCH_EXPANDED,
  115.   STRETCH_EXTRA_EXPANDED,
  116.   STRETCH_ULTRA_EXPANDED
  117. };
  118.  
  119. } // namespace Pango
  120.  
  121.  
  122. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  123. namespace Glib
  124. {
  125.  
  126. template <>
  127. class Value<Pango::Stretch> : public Glib::Value_Enum<Pango::Stretch>
  128. {
  129. public:
  130.   static GType value_type() G_GNUC_CONST;
  131. };
  132.  
  133. } // namespace Glib
  134. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  135.  
  136.  
  137. namespace Pango
  138. {
  139.  
  140. /**
  141.  * @ingroup pangommEnums
  142.  */
  143. enum Weight
  144. {
  145.   WEIGHT_ULTRALIGHT = 200,
  146.   WEIGHT_LIGHT = 300,
  147.   WEIGHT_NORMAL = 400,
  148.   WEIGHT_SEMIBOLD = 600,
  149.   WEIGHT_BOLD = 700,
  150.   WEIGHT_ULTRABOLD = 800,
  151.   WEIGHT_HEAVY = 900
  152. };
  153.  
  154. } // namespace Pango
  155.  
  156.  
  157. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  158. namespace Glib
  159. {
  160.  
  161. template <>
  162. class Value<Pango::Weight> : public Glib::Value_Enum<Pango::Weight>
  163. {
  164. public:
  165.   static GType value_type() G_GNUC_CONST;
  166. };
  167.  
  168. } // namespace Glib
  169. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  170.  
  171.  
  172. namespace Pango
  173. {
  174.  
  175. /**
  176.  * @ingroup pangommEnums
  177.  * @par Bitwise operators:
  178.  * <tt>%FontMask operator|(FontMask, FontMask)</tt><br>
  179.  * <tt>%FontMask operator&(FontMask, FontMask)</tt><br>
  180.  * <tt>%FontMask operator^(FontMask, FontMask)</tt><br>
  181.  * <tt>%FontMask operator~(FontMask)</tt><br>
  182.  * <tt>%FontMask& operator|=(FontMask&, FontMask)</tt><br>
  183.  * <tt>%FontMask& operator&=(FontMask&, FontMask)</tt><br>
  184.  * <tt>%FontMask& operator^=(FontMask&, FontMask)</tt><br>
  185.  */
  186. enum FontMask
  187. {
  188.   FONT_MASK_FAMILY = 1 << 0,
  189.   FONT_MASK_STYLE = 1 << 1,
  190.   FONT_MASK_VARIANT = 1 << 2,
  191.   FONT_MASK_WEIGHT = 1 << 3,
  192.   FONT_MASK_STRETCH = 1 << 4,
  193.   FONT_MASK_SIZE = 1 << 5
  194. };
  195.  
  196. /** @ingroup pangommEnums */
  197. inline FontMask operator|(FontMask lhs, FontMask rhs)
  198.   { return static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
  199.  
  200. /** @ingroup pangommEnums */
  201. inline FontMask operator&(FontMask lhs, FontMask rhs)
  202.   { return static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
  203.  
  204. /** @ingroup pangommEnums */
  205. inline FontMask operator^(FontMask lhs, FontMask rhs)
  206.   { return static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
  207.  
  208. /** @ingroup pangommEnums */
  209. inline FontMask operator~(FontMask flags)
  210.   { return static_cast<FontMask>(~static_cast<unsigned>(flags)); }
  211.  
  212. /** @ingroup pangommEnums */
  213. inline FontMask& operator|=(FontMask& lhs, FontMask rhs)
  214.   { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
  215.  
  216. /** @ingroup pangommEnums */
  217. inline FontMask& operator&=(FontMask& lhs, FontMask rhs)
  218.   { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
  219.  
  220. /** @ingroup pangommEnums */
  221. inline FontMask& operator^=(FontMask& lhs, FontMask rhs)
  222.   { return (lhs = static_cast<FontMask>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
  223.  
  224. } // namespace Pango
  225.  
  226.  
  227. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  228. namespace Glib
  229. {
  230.  
  231. template <>
  232. class Value<Pango::FontMask> : public Glib::Value_Flags<Pango::FontMask>
  233. {
  234. public:
  235.   static GType value_type() G_GNUC_CONST;
  236. };
  237.  
  238. } // namespace Glib
  239. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  240.  
  241.  
  242. namespace Pango
  243. {
  244.  
  245.  
  246. /** A Pango::FontDescription represents the description of an ideal font.
  247.  * It is used both to list what fonts are available on the system and also for specifying the characteristics of a font to load.
  248.  */
  249. class FontDescription
  250. {
  251.   public:
  252. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  253.   typedef FontDescription CppObjectType;
  254.   typedef PangoFontDescription BaseObjectType;
  255.  
  256.   static GType get_type() G_GNUC_CONST;
  257. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  258.  
  259.   FontDescription();
  260.  
  261.   explicit FontDescription(PangoFontDescription* gobject, bool make_a_copy = true);
  262.  
  263.   FontDescription(const FontDescription& other);
  264.   FontDescription& operator=(const FontDescription& other);
  265.  
  266.   ~FontDescription();
  267.  
  268.   void swap(FontDescription& other);
  269.  
  270.   ///Provides access to the underlying C instance.
  271.   PangoFontDescription*       gobj()       { return gobject_; }
  272.  
  273.   ///Provides access to the underlying C instance.
  274.   const PangoFontDescription* gobj() const { return gobject_; }
  275.  
  276.   ///Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.
  277.   PangoFontDescription* gobj_copy() const;
  278.  
  279. protected:
  280.   PangoFontDescription* gobject_;
  281.  
  282. private:
  283.  
  284.   
  285.   /* These functions are dangerous! The first casts the "const" from the parameter away
  286.    * copying the pointer and keep it hanging around.
  287.    * So desc.set_family_static("some_family") would lead to a segfault.
  288.    * The latter makes a shallow copy of the parameter's "family" data member.
  289.    * So if the FontDescription you passed in dies, a pointer to its (deleted)
  290.    * family data member still hangs around!
  291.    * This is why we can't wrap these functions!
  292.    */
  293.   
  294.  
  295. public:
  296.   /** Constructs a font description from a string representation.
  297.    * @a font_name must have the form
  298.    * "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a comma separated
  299.    * list of families optionally terminated by a comma, STYLE_OPTIONS is a whitespace
  300.    * separated list of words where each WORD describes one of style, variant, weight,
  301.    * or stretch, and SIZE is an decimal number (size in points). Any one of the
  302.    * options may be absent. If FAMILY-LIST is absent, then the family_name field
  303.    * of the resulting font description will be initialized to 0. If STYLE-OPTIONS
  304.    * is missing, then all style options will be set to the default values. If SIZE
  305.    * is missing, the size in the resulting font description will be set to 0.
  306.    * @param font_name String representation of a font description.
  307.    */
  308.   explicit FontDescription(const Glib::ustring& font_name);
  309.  
  310.   
  311.   /** Computes a hash of a Pango::FontDescription structure suitable
  312.    * to be used, for example, as an argument to Glib::hash_table_new().
  313.    * @return The hash value.
  314.    */
  315.   guint hash() const;
  316.   
  317.   /** Sets the family name field of a font description. The family
  318.    * name represents a family of related font styles, and will
  319.    * resolve to a particular Pango::FontFamily. In some uses of
  320.    * Pango::FontDescription, it is also possible to use a comma
  321.    * separated list of family names for this field.
  322.    * @param family A string representing the family name.
  323.    */
  324.   void set_family(const Glib::ustring& family);
  325.   
  326.   /** Gets the family name field of a font description. See
  327.    * pango_font_description_set_family().
  328.    * @return The family name field. (Will be <tt>0</tt> if not previously set.).
  329.    */
  330.   Glib::ustring get_family() const;
  331.   
  332.   /** Sets the style field of a Pango::FontDescription. The
  333.    * Pango::Style enumeration describes whether the font is slanted and
  334.    * the manner in which it is slanted; it can be either
  335.    * Pango::STYLE_NORMAL, Pango::STYLE_ITALIC, or Pango::STYLE_OBLIQUE.
  336.    * Most fonts will either have a italic style or an oblique
  337.    * style, but not both, and font matching in Pango will 
  338.    * match italic specifications with oblique fonts and vice-versa
  339.    * if an exact match is not found.
  340.    * @param style The style for the font description.
  341.    */
  342.   void set_style(Style style);
  343.   
  344.   /** Gets the style field of a Pango::FontDescription. See
  345.    * pango_font_description_set_style().
  346.    * @return The style field for the font description. 
  347.    * Use pango_font_description_get_set_fields() to find out if
  348.    * the field was explicitely set or not.
  349.    */
  350.   Style get_style() const;
  351.   
  352.   /** Sets the variant field of a font description. The Pango::Variant
  353.    * can either be Pango::VARIANT_NORMAL or Pango::VARIANT_SMALL_CAPS.
  354.    * @param variant The variant type for the font description.
  355.    */
  356.   void set_variant(Variant variant);
  357.   
  358.   /** Gets the variant field of a Pango::FontDescription. See
  359.    * pango_font_description_set_variant().
  360.    * @return The variant field for the font description. Use
  361.    * pango_font_description_get_set_fields() to find out if
  362.    * the field was explicitely set or not.
  363.    */
  364.   Variant get_variant() const;
  365.   
  366.   /** Sets the weight field of a font description. The weight field
  367.    * specifies how bold or light the font should be. In addition
  368.    * to the values of the Pango::Weight enumeration, other intermediate
  369.    * numeric values are possible.
  370.    * @param weight The weight for the font description.
  371.    */
  372.   void set_weight(Weight weight);
  373.   
  374.   /** Gets the weight field of a font description. See
  375.    * pango_font_description_set_weight().
  376.    * @return The weight field for the font description. Use
  377.    * pango_font_description_get_set_fields() to find out if
  378.    * the field was explicitely set or not.
  379.    */
  380.   Weight get_weight() const;
  381.   
  382.   /** Sets the stretch field of a font description. The stretch field
  383.    * specifies how narrow or wide the font should be.
  384.    * @param stretch The stretch for the font description.
  385.    */
  386.   void set_stretch(Stretch stretch);
  387.   
  388.   /** Gets the stretch field of a font description.
  389.    * See pango_font_description_set_stretch().
  390.    * @return The stretch field for the font description. Use
  391.    * pango_font_description_get_set_fields() to find out if
  392.    * the field was explicitely set or not.
  393.    */
  394.   Stretch get_stretch() const;
  395.   
  396.   /** Sets the size field of a font description in fractional points. This is mutually
  397.    * exclusive with pango_font_description_set_absolute_size().
  398.    * @param size The size of the font in points, scaled by PANGO_SCALE. (That is,
  399.    * a @a size  value of 10 * PANGO_SCALE is a 10 point font. The conversion
  400.    * factor between points and device units depends on system configuration
  401.    * and the output device. For screen display, a logical DPI of 96 is
  402.    * common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3
  403.    * pixel font. Use pango_font_description_set_absolute_size() if you need
  404.    * a particular size in device units.
  405.    */
  406.   void set_size(int size);
  407.   
  408.   /** Gets the size field of a font description.
  409.    * See pango_font_description_get_size().
  410.    * @return The size field for the font description in points or device units.
  411.    * You must call pango_font_description_get_size_is_absolute()
  412.    * to find out which is the case. Returns 0 if the size field has not
  413.    * previously been set.  pango_font_description_get_set_fields() to
  414.    * find out if the field was explicitely set or not.
  415.    */
  416.   int get_size() const;
  417.   
  418.   /** Determines which fields in a font description have been set.
  419.    * @return A bitmask with bits set corresponding to the
  420.    * fields in @a desc  that have been set.
  421.    */
  422.   FontMask get_set_fields() const;
  423.   
  424.   /** Unsets some of the fields in a Pango::FontDescription. Note that
  425.    * this merely marks the fields cleared, it does not clear the
  426.    * settings for those fields, to clear a family name set with
  427.    * pango_font_description_set_family_static() so that it won't
  428.    * be returned by subsequent calls to pango_font_description_get_family(),
  429.    * you must actually call pango_font_description_set_family (desc, <tt>0</tt>);
  430.    * @param to_unset Bitmask of fields in the @a desc  to unset.
  431.    */
  432.   void unset_fields(FontMask to_unset);
  433.   
  434.   /** Merges the fields that are set in @a desc_to_merge  into the fields in
  435.    *  @a desc .  If @a replace_existing  is <tt>false</tt>, only fields in @a desc  that
  436.    * are not already set are affected. If <tt>true</tt>, then fields that are
  437.    * already set will be replaced as well.
  438.    * @param desc_to_merge The Pango::FontDescription to merge from.
  439.    * @param replace_existing If <tt>true</tt>, replace fields in @a desc  with the
  440.    * corresponding values from @a desc_to_merge , even if they
  441.    * are already exist.
  442.    */
  443.   void merge(const FontDescription& desc_to_merge, bool replace_existing);
  444.   
  445.   /** Determines if the style attributes of @a new_match  are a closer match
  446.    * for @a desc  than @a old_match , or if @a old_match  is <tt>0</tt>, determines if
  447.    *  @a new_match  is a match at all. Approximate matching is done for
  448.    * weight and style; other attributes must match exactly.
  449.    * @param old_match A Pango::FontDescription, or <tt>0</tt>.
  450.    * @param new_match A Pango::FontDescription.
  451.    * @return <tt>true</tt> if @a new_match  is a better match.
  452.    */
  453.   bool better_match(const FontDescription& old_match, const FontDescription& new_match) const;
  454.   
  455.   /** Creates a string representation of a font description. See
  456.    * description_from_string() for a description of the
  457.    * format of the string representation. The family list in the
  458.    * string description will only have a terminating comma if the
  459.    * last word of the list is a valid style option.
  460.    * @return The string.
  461.    */
  462.   Glib::ustring to_string() const;
  463.   
  464.   /** Creates a filename representation of a font description. The
  465.    * filename is identical to the result from calling
  466.    * pango_font_description_to_string(), but with underscores instead of
  467.    * characters that are untypical in filenames, and in lower case only.
  468.    * @return The filename.
  469.    */
  470.   Glib::ustring to_filename() const;
  471.  
  472.  
  473. };
  474.  
  475. } //namespace Pango
  476.  
  477.  
  478. namespace Pango
  479. {
  480.  
  481. /** @relates Pango::FontDescription
  482.  * @param lhs The left-hand side
  483.  * @param rhs The right-hand side
  484.  * @result The result
  485.  */
  486. bool operator==(const FontDescription& lhs, const FontDescription& rhs);
  487.  
  488. /** @relates Pango::FontDescription
  489.  * @param lhs The left-hand side
  490.  * @param rhs The right-hand side
  491.  * @result The result
  492.  */
  493. bool operator!=(const FontDescription& lhs, const FontDescription& rhs);
  494.  
  495.  
  496. } // namespace Pango
  497.  
  498.  
  499. namespace Pango
  500. {
  501.  
  502. /** @relates Pango::FontDescription
  503.  * @param lhs The left-hand side
  504.  * @param rhs The right-hand side
  505.  */
  506. inline void swap(FontDescription& lhs, FontDescription& rhs)
  507.   { lhs.swap(rhs); }
  508.  
  509. } // namespace Pango
  510.  
  511. namespace Glib
  512. {
  513.  
  514. /** @relates Pango::FontDescription
  515.  * @param object The C instance
  516.  * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
  517.  * @result A C++ instance that wraps this C instance.
  518.  */
  519. Pango::FontDescription wrap(PangoFontDescription* object, bool take_copy = false);
  520.  
  521. #ifndef DOXYGEN_SHOULD_SKIP_THIS
  522. template <>
  523. class Value<Pango::FontDescription> : public Glib::Value_Boxed<Pango::FontDescription>
  524. {};
  525. #endif /* DOXYGEN_SHOULD_SKIP_THIS */
  526.  
  527. } // namespace Glib
  528.  
  529. #endif /* _PANGOMM_FONTDESCRIPTION_H */
  530.  
  531.